{% extends "base.html" %}
{% block title %}软件信息爬虫模板{% endblock %}

{% block main-content %}

<table>
	<tr><th>模板名称</th><th>开始URL</th><th>当前状态</th>
	<th>最后爬取时间</th><th>爬取总数</th><th>成功数</th></tr>
    {% for t in templates %}
    <tr>
    	<td><a href="{% url list-spider-templates %}{{t.key}}/" title="{{t.key}}">{{t.name}}</a></td>
		<td>{{t.start_url}}</td>
		<td>{{t.status}}</td>
		<td>{{t.last_updated}}</td>
		<td>{{t.total}}</td>
		<td>{{t.success}}</td>
    </tr>
    {% endfor %}
</table>

<div>
	<form action="{% url save-spider-template %}" method="post">
		<p>
			<label for="name">Name:</label>
		    <input type="text" name="name" style="width: 50%;" value="{{select_template.name}}" />
		</p>
		<p>
            <label for="start_url">Start URL:</label>
            <input type="text" name="start_url" style="width: 80%;" value="{{select_template.start_url}}" />
        </p>
		<p>
            <label for="status">Status:</label>
            <input type="text" name="status" value="{{select_template.status|default:"0"}}" />
        </p>
		<p>
            <label for="last_updated">Last updated:</label>
            <input type="text" name="last_updated" value="{{select_template.last_updated}}" />
        </p>
		<p>
            <label for="settings">Settings</label>
            <textarea name="settings" rows="15" style="width: 100%;">{{select_template.settings}}</textarea>
        </p>
		<p>
			<input type="submit" value="Save" />
		</p>
		<input type="hidden" name="tpl_key" value="{{select_template.key}}" />
	</form>
</div>
{% endblock %}